package de.gbeine.java.ebookmanager.tag;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

/**
 *
 */
class TagSet implements Iterable<Tag> {

	/**
	 * The tag set's owner object.
	 */
	private final Tag owner;

	/**
	 *
	 */
	private final Set<Tag> setOfTags = new HashSet<Tag>();

	/**
	 * Create a new tag set.
	 * @param owner
	 */
	public TagSet(final Tag owner) {
		this.owner = owner;
	}

	/**
	 *
	 * @param sub
	 */
	public void add(final Tag sub) {
		sub.setSup(owner);
		this.setOfTags.add(sub);
	}

	@Override
	public Iterator<Tag> iterator() {
		return this.setOfTags.iterator();
	}
}
